package ui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTextField;
import java.awt.Color;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;


import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
public class enterFrame extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JFrame frame = new JFrame("餐饮信息管理系统 ");
    private JPanel imagePanel;
	private ImageIcon background;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					enterFrame frame = new enterFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public enterFrame() {
//	    setIconImage(Toolkit.getDefaultToolkit().getImage(MainMenu.class.getResource("/Images/bug-red.png")));
//	    setTitle("Automated Bug Fixing");
//	 	background = new ImageIcon(this.getClass().getResource("back.jpg"));// 背景图片
//	    JLabel label = new JLabel(background);// 把背景图片显示在一个标签里面
//	    label.setBounds(0, 0, background.getIconWidth(),background.getIconHeight());// 把标签的大小位置设置为图片刚好填充整个面板
//	    imagePanel = (JPanel) frame.getContentPane(); // 把内容窗格转化为JPanel，否则不能用方法setOpaque()来使内容窗格透明
//	    frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE)); // 把背景图片添加到分层窗格的最底层作为背景
		
	    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 520, 354);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JButton BossEnterButton = new JButton("老板");
//		imagePanel.add(BossEnterButton);
		BossEnterButton.setBounds(300, 80, 90, 40);
	 	BossEnterButton.setContentAreaFilled(false);//button透明
//	    BossEnterButton.setBorder(BorderFactory.createRaisedBevelBorder());//button凸起
	    BossEnterButton.setFont(new  java.awt.Font("宋体",  1,  15));
	    BossEnterButton.setBackground(Color.green);
	    
		JButton CustomerEnterButton = new JButton("顾客");
		/**
		 * 监听顾客入口
		 */
		CustomerEnterButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CustomerLoginFrame frame = new CustomerLoginFrame();
                frame.setVisible(true);
			}
		});
		//设置按钮样式
//		imagePanel.add(CustomerEnterButton);
		CustomerEnterButton.setBounds(300, 80, 90, 40);
	 	CustomerEnterButton.setContentAreaFilled(false);//button透明
//	    CustomerEnterButton.setBorder(BorderFactory.createRaisedBevelBorder());//button凸起
	    CustomerEnterButton.setFont(new  java.awt.Font("宋体",  1,  15));
	    CustomerEnterButton.setBackground(Color.green);
	    
	    
		textField = new JTextField();
		textField.setFont(new Font("微软雅黑", Font.PLAIN, 24));
		textField.setEditable(false);
		textField.setForeground(Color.ORANGE);
		textField.setText("欢迎光临");
		textField.setColumns(10);
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addContainerGap(390, Short.MAX_VALUE)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false)
						.addComponent(CustomerEnterButton, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(BossEnterButton, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
					.addGap(33))
				.addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup()
					.addGap(118)
					.addComponent(textField, GroupLayout.PREFERRED_SIZE, 121, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(249, Short.MAX_VALUE))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGap(35)
					.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(18)
					.addComponent(BossEnterButton, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
					.addGap(37)
					.addComponent(CustomerEnterButton, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(82, Short.MAX_VALUE))
		);
		contentPane.setLayout(gl_contentPane);
	}
}
